<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
      
    var sum = 10000                 
    for(var i=1;i<=50;i++){
        sum +=sum*0.05           
    }
    console.log(sum);
    

    var total=10000;
    var count=0;
    while(count<50){
         total=total*1.05
         count=count+1;
    }
    console.log(total)

    //递归
    //函数自己调用自己
    //函数参数初始化值
    function getTotal(total,count=0){
        total=total*1.05
        count=count+1

        // console.log(total)
        // console.log(count)
        if(count<50){
            return getTotal(total,count)
        }else{
            return total
        }
    }
    var newTotal=getTotal(10000)
    console.log(newTotal)
  </script>
</body>
</html>